#include <stdio.h>
#include <string.h>
#include "CRC8.h"
#include "StructSave.h"



int main(void)
{
	char a[10] =
	{
		0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0
	};
	char res= CRC8(a, 10);
	printf("res is:0x%02x", res);

	stu stu1;
	stu stu2;
	stu1.age1 = 13;
	stu1.age2 = 15;
	memcpy(stu1.name, "this", 5);
	//*(stu1.name) = "this";

	/*FILE *fp;

	if ((fp = fopen("a.txt", "wb")) == NULL)
	{
		printf("can not open the file %s", "a.txt");
		return 0;
	}
	int n=fwrite(&stu1, 1, sizeof(struct student), fp);
	
	fclose(fp);*/

	SaveStruct(&stu1, sizeof(struct student), "a.txt");

	ReadStruct(&stu2, sizeof(struct student), "a.txt");

	return 0;
}
